<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //累加器
      var arr = [1, 2, 3, 4, 5]
      let res = arr.reduce((a, b, index) => {
        console.log('上次结果', a)
        console.log('这次累加的值', b)
        console.log('key值：', index)
        return a + b
      }, 0)
      console.log(res)
      //  数组去重
      var arr = [1, 2, 3, 4, 5, 5, 4, 3, 2, 2, 2, 2]
      arr.reduce((pre,cur)=>{
         
    })
    </script>
  </body>
</html>
